package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import logic.AddressLogic;
import logic.DetailLogic;
import model.Address;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;


public class AddressDetailShowAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		DynaActionForm dForm = (DynaActionForm) form;
		int id = ((Integer) dForm.get("id")).intValue();
		DetailLogic dtLogic = new DetailLogic();
		Address add = dtLogic.detailAddress(id);
		request.getSession().setAttribute("address",add);

		request.setAttribute("address", add);
		AddressLogic logic2 = new AddressLogic();
		logic2.getAllAddresses(request);

		return mapping.findForward("show");
	}
}